import React from 'react';

var videojs = require('video.js');
require('videojs-contrib-hls');

/*require('../www/CommentCoreLibrary');
require('../www/BilibiliFormat');
require('../www/videojs_ABdm');*/


export default class VideoPlayer extends React.Component {
    componentDidMount() {

        /*window.addEventListener("load", function () {
            window.thevideojs = videojs(this.videoNode, this.props, function onPlayerReady() {
                console.log('onPlayerReady here');
                console.log(window.thevideojs);

                console.log('onPlayerReady', this)
            });
            thevideojs.ABP();
            thevideojs.danmu.load("207527.xml");
        });*/


        this.player = videojs(this.videoNode, this.props, function onPlayerReady() {
            console.log('onPlayerReady here');
            console.log('onPlayerReady', this)
        });

        /*this.player.ABP();
        this.player.danmu.load("207527.xml");*/
    }

    componentWillUnmount() {
        if (this.player) {
            //this.player.dispose()
        }
    }

    render() {
        return (
            <div data-vjs-player>
                <video id="example_video_1" ref={ node => this.videoNode = node }
                       className="video-js vjs-default-skin"></video>
            </div>
        )
    }
}